package com.joejag.mavenstats.client.views.forms.project.edit;

import com.joejag.mavenstats.client.dto.ProjectDTO;
import com.joejag.mavenstats.client.views.forms.project.ProjectDTOForm;

public class EditProjectDTOForm extends ProjectDTOForm
{
  private final ProjectDTO project;

  public EditProjectDTOForm(final ProjectDTO project)
  {
    super(project, "Edit Project: " + project.projectURL);
    this.project = project;
  }

  protected void createLayout(ProjectDTO project)
  {
    createTeamSelectorCombo(project);
    createProjectNameTextfield(project);
  }

  public String getText()
  {
    return "Edit";
  }

  public void performSomeAction(ProjectDTO project)
  {
    new EditProjectAction().performSomeAction(project);
  }

  public ProjectDTO getProject()
  {
    project.teamname = teamNameCombo.getRawValue();
    project.projectName = projectName.getText();

    return project;
  }

}
